<?php
/**
 *      [迷你云] (C)2009-2012 南京恒为网络科技.
 *   软件仅供研究与学习使用，如需商用，请访问www.miniyun.cn获得授权
 * 
 */
?>
<div class="top-handle">
    <div class="con" id="js_page_op_menu">
        <div class="btn-wrap" id="js_menu_btn_warp">
            <?php if ($aid == 2){?>
<!--                <a href="javascript:;" class="btn btn-disabled" menu="shareto">分享</a>-->
            <!--                <a href="javascript:;" class="btn btn-disabled" menu="view_doc">预览</a>-->
            <a href="javascript:;" class="btn btn-disabled" menu="download">下载</a>
            <?php }elseif ($aid == 3){?>
<!--                <a href="javascript:;" class="btn btn-disabled" menu="shareto">分享</a>-->
            <a href="javascript:;" class="btn btn-disabled" menu="view_photo">预览</a>
            <a href="javascript:;" class="btn btn-disabled" menu="download">下载</a>
            <?php }elseif ($aid == 4){?>   
<!--                <a href="javascript:;" class="btn btn-disabled" menu="shareto">分享</a>-->
            <a href="javascript:;" class="btn btn-disabled" menu="view_music">试听</a>
            <a href="javascript:;" class="btn btn-disabled" menu="add_music">加入播放列表</a>
            <a href="javascript:;" class="btn btn-disabled" menu="download">下载</a>
            <?php }elseif ($aid == 9){?>       
<!--                <a href="javascript:;" class="btn btn-disabled" menu="shareto">分享</a>-->
            <a href="javascript:;" class="btn btn-disabled" menu="download">下载</a>
            <?php }elseif ($aid == 30){?>       
            <a href="javascript:;" class="button btn-gray" onclick="parent.window.Main.Core.FileAPI.RenewAll(function(){window.location.reload();}); return false;">一键续期</a>
            <div class="btn-wrap">
                <a href="javascript:;" class="btn btn-disabled" menu="renew">续期</a> <a href="javascript:;" class="btn btn-disabled" menu="download">下载</a>
             <?php }elseif ($aid == 31){?>       
<!--                <a href="javascript:;" class="btn btn-disabled" menu="shareto">分享</a>-->
                <a href="javascript:;" class="btn btn-disabled" menu="download">下载</a>
             <?php }elseif ($aid == 32){?>       
<!--                <a href="javascript:;" class="btn btn-disabled" menu="shareto">分享</a>-->
                <a href="javascript:;" class="btn btn-disabled" menu="download">下载</a>
             <?php }elseif ($aid == 7){?>       
                <a href="javascript:;" class="btn btn-disabled" menu="restore">还原</a> <a href="javascript:;" class="btn btn-disabled" menu="delete_rb">删除</a>
                <a href="javascript:;" class="button btn-gray btn-disabled" menu="clear">清空回收站</a>
             <?php }?>
            
             <?php if($aid == 3 && $count > 0 && $list[0]["file_type"] ==1){?>
             <?php }else{?>
                <a href="javascript:;" class="btn btn-opt btn-disabled" menu="more">更多操作<i class="arrow"></i></a>
             <?php }?>
            </div>
            <script type="text/javascript">
                $(document).ready(function(){
                    var arr = {"download": 1, "view_music":1};
                    if(document.all){
                        arr = {"download": 1, "view_doc":1, "add_music":1};
                    }
                    var box = $("#js_menu_btn_warp");

                    var list = [];
                    for(var k in arr){
                        if(arr[k]){
                            list.push(box.find("[menu='"+k+"']"));
                        }
                    }
                    var hideTopMenuBtn = function(){
                        var w = $(document).width();
                        if(w < 900){
                            for(var i = 0, len = list.length; i < len; i++){
                                list[i].hide();
                            }
                        }
                        else{
                            for(var i = 0, len = list.length; i < len; i++){
                                list[i].show();
                            }
                        }
                    }
                    hideTopMenuBtn();
                    $(window).bind("resize", function(){hideTopMenuBtn();});
                })
            </script>



            <div class="search-box">
                <form id="js_search_file_form">
                    <label for="js_search_input">搜索文件</label> <input
                        type="text" class="text" name="search_value"
                        autocomplete="off" value="" id="js_search_input">
                    <button type="submit">
                        <i>搜索</i>
                    </button>

                </form>
                <script type="text/javascript"
                    src="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/js/search_file.js?v=<?php echo(Yii::app()->params['app']['version'])?>"></script>
            </div>

            <div class="btn-wrap" style="float: right;">
            <?php if(empty($ids)){?>
                <a href="javascript:;" class="btn focus" onclick="parent.window.PageCTL.ChangeMode('list'); return false;"><b class="list-type type-list">列表</b></a>
                <a href="javascript:;" class="btn " onclick="parent.window.PageCTL.ChangeMode('view'); return false;"><b class="list-type type-thumb">缩略图</b></a>
                <a href="javascript:;" class="btn " onclick="parent.window.PageCTL.ChangeMode('view_large'); return false;"><b class="list-type type-large">大缩略图</b></a>
            <?php }else{ ?>
                <a href="javascript:;" class="btn focus" onclick="parent.window.PageCTL.GOTO_MAP(<?php echo "'list', '".$ids."', '".$loc."'"; ?>); return false;  "><b class="list-type type-list">列表</b></a>
                <a href="javascript:;" class="btn " onclick="parent.window.PageCTL.GOTO_MAP(<?php echo "'view', '".$ids."', '".$loc."'"; ?>); return false;  "><b class="list-type type-thumb">缩略图</b></a>
                <a href="javascript:;" class="btn " onclick="parent.window.PageCTL.GOTO_MAP(<?php echo "'view_large', '".$ids."', '".$loc."'"; ?>); return false;  "><b class="list-type type-large">大缩略图</b></a>
            <?php }?>
            </div>
        </div>
    </div>
    <script type="text/javascript">
    try{
        if(parent){
            parent.window.PageCTL.MarkURL(window.location.href);
        }
    }catch(e){}
</script>
    <div class="page-main">
        <div class="col-main" id="js_cantain_box">
            <div class="path-box" rel="page_local"></div>
            <div class="list-container" id="js_data_list_outer">
                <?php if ($count > 0){ ?>
                    <div style="min-height: 100%; _height: 100%; cursor: default;" id="js_data_list">
                    <dl class="file-list <?php if ($aid != 31){ echo "list-star";}?>" rel="list" id="js_data_list_inner">
                        <dt>
                            <ul>
                                <li class="file-check"><input type="checkbox" check="all" id="js_datalist_check_all"><label for="js_datalist_check_all">全选</label></li>
                                <li class="file-name" order="file_name"><a href="javascript:;">文件名</a></li>
                                <li class="file-time" order="user_ptime"><a href="javascript:;">上传时间</a></li>
                                <li class="file-size" order="file_size"><a href="javascript:;">大小</a></li>
                            </ul>
                        </dt>

                        <?php foreach($list as $file){?>
                        <?php
                            if($file['file_type'] == 0) {
                                $isExist = @Thumbnail::$_support_types[$file['ext']];
                                $imgUrl = "";
                                if($isExist) {
                                    $imgUrl = htmlspecialchars("img_url='" . Yii::app()->params['app']['host'] . "/index.php?r=thumbnail/index&size=normal&tid=" . $file['id'] . "&ver=" . $file['version_id'] . "'");
                                }
                        ?>
                            <dd rel="item" title="<?php echo $basic["titleName"];?>" file_type="1" file_size="<?php echo $file['byte']?>" user_ptime="<?php echo $file['file_update_time']?>" is_share="0" pick_expire="" file_id="<?php echo $file['id']?>" file_status="1" area_id="<?php echo $type=isset($file['type'])?$file['type']:$aid?>" p_id="<?php echo $file['parent_file_id']?>" pick_code="<?php echo $file['id']?>" path="<?php echo(Yii::app()->params['app']['host'])?>/index.php?r=operate/index&ct=pickcode&ac=download&pickcode=<?php echo $file['id']?>"<?php echo $imgUrl;?>file_version_id=<?php echo $file['version_id'];?> file_gps="<?php echo $file['gps']?>"  s=<?php echo ($currentPage-1)*$limit?> limit=<?php echo $limit?> ids="<?php if(isset($ids)){ echo($ids);}?>" >
                            <textarea style="display: none;" field="desc"></textarea>
                            <ul>
                                <li class="file-check">
                                    <input type="checkbox" value="<?php echo $file['id']?>" />
                                    <?php if($file['is_star']==1){ ?>
                                        <a class="star-favor star-collect" title="加入我的最爱" is_star="1" menu="star" href="javascript:;">最爱</a>
                                    <?php }else{ ?>
                                        <a class="star-favor " title=" 加入我的最爱" menu="star" href="javascript:;">最爱</a>
                                    <?php }?>
                                    
                                    <?php if($aid == 3 || $aid == 35){ ?>
                                        <?php if(!empty($file['gps'])){ ?>
                                            <a class="location location-collect" title="地图显示" is_exif="1" tpl="list_pg" file_name=<?php echo $file['file_name']?> menu="location" href="javascript:;">地理</a>
                                        <?php }?>
                                    <?php }?>
                                    </li>
                                <li class="file-name"><i class="file-type tp-<?php echo $file['ext']?>"></i>
                                    <span class="name-con">
                                    <a href="javascript:;" target="_blank" title="<?php echo $file['file_name']?>" rel="<?php echo $basic["type"];?>" field="file_name"><?php echo $file['file_name']?></a>
                                </span></li>
                                <li class="file-time"><?php echo $file['created_at']?></li>

                                <li class="file-size"><?php echo $file['file_size']?></li>
                            </ul>
                        </dd>
                             <?php }else{ ?>
                                <dd rel="item" title="双击进入文件夹 <?php echo $file['file_name']?>" file_type="0" is_share="0" area_id="<?php echo $type=isset($file['type'])?$file['type']:$aid?>" p_id="<?php echo $file['parent_file_id']?>" cate_id="<?php echo $file['id']?>" cate_name="<?php echo $file['file_name']?>" pick_code="" has_pass="0" file_pwd="">
                            <ul>
                                <li class="file-check"><input type="checkbox" value="<?php echo $file['id']?>" />
                                    <textarea style="display: none;" field="ext3"></textarea></li>

                                <li class="file-name">
                                    <i class="file-type tp-folder"></i>
                                    <span class="name-con">
                                        <a href="javascript:;" cate="1" btn="goto_dir" aid="<?php echo $aid?>" cid="<?php echo $file['id']?>" title="<?php echo $file['file_name']?>" rel="view_folder"><?php echo $file['file_name']?>
                                        </a>
                                    </span>
                                </li>
                                <li class="file-time">&nbsp;</li>
                                <li class="file-size">&nbsp;</li>
                            </ul>
                        </dd>
                             <?php }?>
                             <?php }?> 
                         </dl>
                </div>
                    
                    <?php }else{ ?>
                    <div class="no-file">
                    <div class="page-info">
                    <?php echo $basic["prompt"];?>
                 <?php }?>
                             
                    </div>

                    <div class="pages">
                        <div class="con">
                    <?php if ($pageSize > 1){ ?>
                    <?php if ($currentPage == 1){ ?>
                        <span class='btn btn-prev'>上一页</span>
                    <?php }else{?>
                        <a href='<?php echo(Yii::app()->params['app']['host'])?>/index.php?r=list/index&ct=file&ac=userfile&limit=<?php echo $limit?>&tpl=list_pg&aid=<?php echo $aid?>&cid=<?php echo $cid?>&s=<?php echo ($currentPage-2)*$limit?><?php if(isset($ids)){ echo("&flag=-1&loc=". $loc ."&ids=".$ids);}?>' class='btn btn-prev'>上一页</a>
                    <?php }?>
                     <?php
                        
                        for($i = 1; $i <= $pageSize; $i ++) {
                            $css = "";
                            if($i == $currentPage) {
                                $css = "class='focus'";
                            }
                            ?>
                    <a href='<?php echo(Yii::app()->params['app']['host'])?>/index.php?r=list/index&ct=file&ac=userfile&limit=<?php echo $limit?>&tpl=list_pg&aid=<?php echo $aid?>&cid=<?php echo $cid?>&s=<?php echo ($i-1)*$limit?><?php if(isset($ids)){ echo("&flag=-1&loc=". $loc ."&ids=".$ids);}?>' <?php echo $css?>'><?php echo $i?></a> 
                    <?php } ?>
                    <?php if ($pageSize == $currentPage) {?>
                        <span class="btn btn-next">下一页</span>
                    <?php }else{ ?>
                        <a href='<?php echo(Yii::app()->params['app']['host'])?>/index.php?r=list/index&ct=file&ac=userfile&limit=<?php echo $limit?>&tpl=list_pg&aid=<?php echo $aid?>&cid=<?php echo $cid?>&s=<?php echo ($currentPage)*$limit?><?php if(isset($ids)){ echo("&flag=-1&loc=". $loc ."&ids=".$ids);}?>' class='btn btn-next'>下一页</a>
                    <?php }} ?>
                </div>
                    </div>
                </div>
                <div class="col-sub">
                    <div id="js_right_side"></div>
                    <div class="sub-space" id="js_space_box" style="display: none;">
                        <i class="icon"></i><span rel="space_text"></span><span class="space-status"><i style="width: 0;" rel="space_line"></i></span>
                    </div>
                </div>
            </div>
        
        
    <?php
    $navStr = "";
    if(isset($nav)) {
        foreach($nav as $data) {
            $fileName = $data["fileName"];
            $id = $data["id"];
            $parent_file_id = $data["parent_file_id"];
            $navStr = $navStr . ",{\"name\":\"$fileName\",\"aid\":1,\"cid\":\"$id\",\"pid\":$parent_file_id}";
        }
    }
    ?>

  <script type="text/javascript">
        var IsTempLoad = true;
        var dataSource = {aid: <?php echo $aid?>, cid: <?php echo $cid;?>, order: ''};
        <?php if($aid == 3 && $count > 0 && $list[0]["file_type"] > 0){?>
            var NoRightSide = true;
        <?php }else{?>
            var NoRightSide = false;
        <?php }?>
        var LIST_CONFIG = {
            top_tip: eval('([{"name":"<?php echo $basic["cataName"];?>","aid":<?php echo $aid;?>,"cid":"-1","pid":0}<?php echo $navStr?>])')
        };
   </script>
   <!--加载谷歌地图api-->
   <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>